import { makeAutoObservable, runInAction } from 'mobx';
import { findCinemas } from '@/api/MaiZuo';

class CinemaStore {
  list = [];

  constructor() {
    makeAutoObservable(this);
  }

  changeList(list = []) {
    this.list = list;
  }

  async fetchList(cityId = 110100) {
    // 异步
    const res = await findCinemas(cityId);
    runInAction(() => {
      this.list = res.cinemas || [];
    });
  }
}

export default CinemaStore;
